package com.itheima.app.controller;

import com.itheima.app.manager.SoundManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@RestController
public class SoundController {

    @Autowired
    private SoundManager soundManager;
    //发布音频
    @PostMapping("/peachblossom")
    public void publishSound(MultipartFile soundFile) throws IOException {

        soundManager.publishSound(soundFile);
    }

    //接收音频
    @GetMapping("/peachblossom")
    public ResponseEntity findSound() {
        return soundManager.findSound();
    }
}
